package cn.joyfulmedia.common.dto;

import cn.joyfulmedia.common.result.ResultCodeInterface;

public class APIException extends RuntimeException {

    private static final long serialVersionUID = 6175953469791027763L;
    private int resultCode;

    private String errorMessage;

    public APIException(int resultCode, String errorMessage) {
        super(errorMessage);
        this.resultCode = resultCode;
        this.errorMessage = errorMessage;
    }


    public APIException(ResultCodeInterface codeEnum) {
        super(codeEnum.getMessage());
        this.resultCode = codeEnum.getResultCode();
        this.errorMessage = codeEnum.getMessage();
    }

    public int getResultCode() {
        return this.resultCode;
    }

    public String getErrorMessage() {
        return this.errorMessage;
    }
}
